Sys.setenv("plotly_username"="hanyan")
Sys.setenv("plotly_api_key"="your_api_key")
drinks$continent = countrycode(drinks$country, 'country.name', 'continent')
## Warning in countrycode(drinks$country, "country.name", "continent"): Some values were not matched unambiguously: Micronesia
plot_ly(drinks, x = ~beer_servings, y = ~spirit_servings, z = ~wine_servings,
size=~total_litres_of_pure_alcohol, color = ~continent,
marker = list(symbol = 'circle', sizemode = 'diameter'),
sizes = c(1, 20)) %>%
add_markers()
beer<- cbind(region = rownames(regionalconsumption("beer_servings")), regionalconsumption("beer_servings")) %>%mutate(row.names=NULL) %>% arrange(-meanbeer_servingsbyStern) %>% rename(beer_serving=meanbeer_servingsbyStern) %>% mutate(beer_serving=round(beer_serving))
beer %>% formattable(align="l")
| region | beer_serving |
|---|---|
| North America | 244 |
| Europe | 189 |
| South America | 175 |
| Central America | 148 |
| Caribbean | 128 |
| Australasia | 92 |
| South+E Africa | 83 |
| East Asia | 56 |
| West Africa | 52 |
| Central Asia | 34 |
| North Africa | 17 |
| West Asia | 11 |
| South Asia | 8 |
| region | spirit_serving |
|---|---|
| Caribbean | 216 |
| North America | 140 |
| Europe | 133 |
| South America | 115 |
| Central America | 91 |
| Central Asia | 88 |
| East Asia | 71 |
| Australasia | 59 |
| South Asia | 32 |
| West Asia | 31 |
| South+E Africa | 19 |
| West Africa | 17 |
| North Africa | 4 |
| region | wine_serving |
|---|---|
| Europe | 135 |
| North America | 92 |
| South America | 62 |
| Australasia | 37 |
| Caribbean | 25 |
| West Africa | 23 |
| East Asia | 12 |
| South+E Africa | 11 |
| Central Asia | 10 |
| North Africa | 8 |
| Central America | 6 |
| West Asia | 6 |
| South Asia | 0 |
## 187 codes from your data successfully matched countries in the map
## 6 codes from your data failed to match with a country code in the map
## failedCodes failedCountries
## [1,] NA "Antigua & Barbuda"
## [2,] NA "Cabo Verde"
## [3,] NA "DR Congo"
## [4,] NA "Micronesia"
## [5,] NA "St. Vincent & the Grenadines"
## [6,] NA "Trinidad & Tobago"
## 56 codes from the map weren't represented in your data
## [1] TRUE